package theOrbalEra.client.render.model;

import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;

public class ModelStreetlight extends ModelBase {
	// fields
	ModelRenderer	buttomEdge1;
	ModelRenderer	buttomEdge2;
	ModelRenderer	buttomEdge3;
	ModelRenderer	buttomEdge4;
	ModelRenderer	buttom1;
	ModelRenderer	buttom2;
	ModelRenderer	body;
	ModelRenderer	head;
	ModelRenderer	top;
	ModelRenderer	topEdge1;
	ModelRenderer	topEdge2;
	ModelRenderer	topEdge3;
	ModelRenderer	topEdge4;
	ModelRenderer	chain1;
	ModelRenderer	chain2;
	ModelRenderer	chain3;
	ModelRenderer	chain4;

	public ModelStreetlight() {
		textureWidth = 64;
		textureHeight = 76;

		buttomEdge1 = new ModelRenderer(this, 0, 0);
		buttomEdge1.addBox(0F, 0F, 0F, 4, 1, 1);
		buttomEdge1.setRotationPoint(-2F, 23F, -8F);
		buttomEdge1.setTextureSize(64, 76);
		buttomEdge1.mirror = true;
		setRotationPoint(buttomEdge1, 0F, 0F, 0F);
		buttomEdge2 = new ModelRenderer(this, 0, 0);
		buttomEdge2.addBox(0F, 0F, 0F, 4, 1, 1);
		buttomEdge2.setRotationPoint(-2F, 23F, 7F);
		buttomEdge2.setTextureSize(64, 76);
		buttomEdge2.mirror = true;
		setRotationPoint(buttomEdge2, 0F, 0F, 0F);
		buttomEdge3 = new ModelRenderer(this, 0, 2);
		buttomEdge3.addBox(0F, 0F, 0F, 1, 1, 4);
		buttomEdge3.setRotationPoint(7F, 23F, -2F);
		buttomEdge3.setTextureSize(64, 76);
		buttomEdge3.mirror = true;
		setRotationPoint(buttomEdge3, 0F, 0F, 0F);
		buttomEdge4 = new ModelRenderer(this, 0, 2);
		buttomEdge4.addBox(0F, 0F, 0F, 1, 1, 4);
		buttomEdge4.setRotationPoint(-8F, 23F, -2F);
		buttomEdge4.setTextureSize(64, 76);
		buttomEdge4.mirror = true;
		setRotationPoint(buttomEdge4, 0F, 0F, 0F);
		buttom1 = new ModelRenderer(this, 0, 61);
		buttom1.addBox(0F, 0F, 0F, 14, 1, 14);
		buttom1.setRotationPoint(-7F, 23F, -7F);
		buttom1.setTextureSize(64, 76);
		buttom1.mirror = true;
		setRotationPoint(buttom1, 0F, 0F, 0F);
		buttom2 = new ModelRenderer(this, 4, 63);
		buttom2.addBox(0F, 0F, 0F, 12, 1, 12);
		buttom2.setRotationPoint(-6F, 22F, -6F);
		buttom2.setTextureSize(64, 76);
		buttom2.mirror = true;
		setRotationPoint(buttom2, 0F, 0F, 0F);
		body = new ModelRenderer(this, 0, 33);
		body.addBox(0F, 0F, 0F, 10, 18, 10);
		body.setRotationPoint(-5F, 4F, -5F);
		body.setTextureSize(64, 76);
		body.mirror = true;
		setRotationPoint(body, 0F, 0F, 0F);
		head = new ModelRenderer(this, 0, 15);
		head.addBox(0F, 0F, 0F, 8, 10, 8);
		head.setRotationPoint(-4F, -6F, -4F);
		head.setTextureSize(64, 76);
		head.mirror = true;
		setRotationPoint(head, 0F, 0F, 0F);
		top = new ModelRenderer(this, 0, 7);
		top.addBox(0F, 0F, 0F, 6, 2, 6);
		top.setRotationPoint(-3F, -8F, -3F);
		top.setTextureSize(64, 76);
		top.mirror = true;
		setRotationPoint(top, 0F, 0F, 0F);
		topEdge1 = new ModelRenderer(this, 10, 0);
		topEdge1.addBox(-4F, 0F, -2F, 4, 1, 2);
		topEdge1.setRotationPoint(2F, -7F, 5F);
		topEdge1.setTextureSize(64, 76);
		topEdge1.mirror = true;
		setRotationPoint(topEdge1, -0.1396263F, 0F, 0F);
		topEdge2 = new ModelRenderer(this, 22, 0);
		topEdge2.addBox(-2F, 0F, -4F, 2, 1, 4);
		topEdge2.setRotationPoint(5F, -7F, 2F);
		topEdge2.setTextureSize(64, 76);
		topEdge2.mirror = true;
		setRotationPoint(topEdge2, 0F, 0F, 0.1396263F);
		topEdge3 = new ModelRenderer(this, 10, 0);
		topEdge3.addBox(0F, 0F, 0F, 4, 1, 2);
		topEdge3.setRotationPoint(-2F, -7F, -5F);
		topEdge3.setTextureSize(64, 76);
		topEdge3.mirror = true;
		setRotationPoint(topEdge3, 0.1396263F, 0F, 0F);
		topEdge4 = new ModelRenderer(this, 22, 0);
		topEdge4.addBox(0F, 0F, 0F, 2, 1, 4);
		topEdge4.setRotationPoint(-5F, -7F, -2F);
		topEdge4.setTextureSize(64, 76);
		topEdge4.mirror = true;
		setRotationPoint(topEdge4, 0F, 0F, -0.1396263F);
		chain1 = new ModelRenderer(this, 34, 0);
		chain1.addBox(0F, -16F, 0F, 4, 29, 0);
		chain1.setRotationPoint(-2F, 10F, -6F);
		chain1.setTextureSize(64, 76);
		chain1.mirror = true;
		setRotationPoint(chain1, -0.0698132F, 0F, 0F);
		chain2 = new ModelRenderer(this, 34, 0);
		chain2.addBox(0F, -16F, 0F, 4, 29, 0);
		chain2.setRotationPoint(-2F, 10F, 6F);
		chain2.setTextureSize(64, 76);
		chain2.mirror = true;
		setRotationPoint(chain2, 0.0698132F, 0F, 0F);
		chain3 = new ModelRenderer(this, 34, -4);
		chain3.addBox(0F, -16F, 0F, 0, 29, 4);
		chain3.setRotationPoint(6F, 10F, -2F);
		chain3.setTextureSize(64, 76);
		chain3.mirror = true;
		setRotationPoint(chain3, 0F, 0F, -0.0698132F);
		chain4 = new ModelRenderer(this, 34, -4);
		chain4.addBox(0F, -16F, 0F, 0, 29, 4);
		chain4.setRotationPoint(-6F, 10F, -2F);
		chain4.setTextureSize(64, 76);
		chain4.mirror = true;
		setRotationPoint(chain4, 0F, 0F, 0.0698132F);
	}

	@Override
	public void render(Entity entity, float f, float f1, float f2, float f3,float f4, float f5) {
		super.render(entity, f, f1, f2, f3, f4, f5);
		setRotationAngles(f, f1, f2, f3, f4, f5, entity);
		buttomEdge1.render(f5);
		buttomEdge2.render(f5);
		buttomEdge3.render(f5);
		buttomEdge4.render(f5);
		buttom1.render(f5);
		buttom2.render(f5);
		body.render(f5);
		head.render(f5);
		top.render(f5);
		topEdge1.render(f5);
		topEdge2.render(f5);
		topEdge3.render(f5);
		topEdge4.render(f5);
		chain1.render(f5);
		chain2.render(f5);
		chain3.render(f5);
		chain4.render(f5);

	}

	private void setRotationPoint(ModelRenderer model, float x, float y, float z) {
		model.rotateAngleX = x;
		model.rotateAngleY = y;
		model.rotateAngleZ = z;
	}

	@Override
	public void setRotationAngles(float f, float f1, float f2, float f3,
			float f4, float f5, Entity entity) {
		super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
	}

	public void renderThis(float size) {
		buttomEdge1.render(size);
		buttomEdge2.render(size);
		buttomEdge3.render(size);
		buttomEdge4.render(size);
		buttom1.render(size);
		buttom2.render(size);
		body.render(size);
		head.render(size);
		top.render(size);
		topEdge1.render(size);
		topEdge2.render(size);
		topEdge3.render(size);
		topEdge4.render(size);
		chain1.render(size);
		chain2.render(size);
		chain3.render(size);
		chain4.render(size);

	}

}
